{% extends "base.html" %}
{% block title %}{{supplier.organization_name|safe}}{% endblock %}
{% block inner_scripts %}
<script type='text/javascript'>
google.setOnLoadCallback(drawCharts);
function drawCharts() {
  {
    $.getJSON('/expenses',
              {'supplier': '{{supplier.key.name}}',
               'dim': 'type'},
              function(sourceData) {
                var data = sumJSON2DataTable(sourceData);
                drawTypesPieChart('categories_chart', data);
                var table = new google.visualization.Table(document.getElementById('categories_table'));
                table.draw(data, {showRowNumber: true, allowHtml: true});
              });
  }
  {
    $.getJSON('/time_chart',
              {'supplier': '{{supplier.key.name}}'},
              function(sourceData) {
                drawTimeChart('months_bar_chart', sumJSON2DataTable(sourceData));
              });
  }
};
</script>
{% endblock %}
{% block suppliers-selected %}selected{% endblock %}
{% block content %}
<h2 class="center_title">{{supplier.organization_name|safe}}</h2>
<div>
<ul class="cb">
  <li> ИНН: {{supplier.inn}}</li>
  {% if supplier.kpp %}
  <li> КПП: {{supplier.kpp}}</li>
  {% endif %}
  <li> Фактический адрес: {{supplier.factual_address}}</li>
</ul>
</div>
<div class="table_wrapper">
  <h2>Доход от госзакупок по видам продукции и услуг.</h2>
    <div class="cb"></div>
  <table>
    <tr>
      <td style="vertical-align: top;">
        <div id="categories_chart"></div>
      </td>
      <td style="vertical-align: top;">
        <div id="categories_table"></div>
      </td>
    </tr>
  </table>
  <!-- <div class="cb"></div> -->
  <div class="table_wrapper">
    <h2>Доход от госзакупок за период с {{config.start_date}} по {{config.actuality_date}}</h2>
    <div class="cb"></div>
    <div id="months_bar_chart"></div>
    <div class="cb"></div>
  </div>
</div>

{% endblock %}
